/*
 * NumberValidatorTests.cpp
 *
 *  Created on: 02 Ιουν 2010
 *      Author: Sartios
 */

#include "NumberValidatorTests.h"

#include "../../../Validators/AddressValidators/NumberValidators/StreetNumberValidator.h"

void	NumberValidatorTests::setUp(){
	streetNumberValidator = new StreetNumberValidator;
	symbols_ = new string("!@#$%^&*\\\"\(\(\',.?/;:}]{[|+=_-~`");
}

void	NumberValidatorTests::tearDown(){
	delete streetNumberValidator;
	delete symbols_;
	symbols_=NULL;
	streetNumberValidator=NULL;
}

void	NumberValidatorTests::streetNumberHasAppropriateContent_NumbersAsContent_ReturnTrue(){
	string *streetNumer=new string("213");
	bool result=streetNumberValidator->streetNumberHasAppropriateContent(streetNumer);
	delete streetNumer;
	CPPUNIT_ASSERT_MESSAGE("Should pass because street number should contains numbers",result);
}

void	NumberValidatorTests::streetNumberHasAppropriateContent_CharsAsContent_ReturnFalse(){
	string *streetNumer=new string("ena");
	bool result=streetNumberValidator->streetNumberHasAppropriateContent(streetNumer);
	delete streetNumer;
	CPPUNIT_ASSERT_MESSAGE("Should fail because chars are not valid content",result);

}

void	NumberValidatorTests::streetNumberHasAppropriateContent_SymbolsAsContent_ReturnFalse(){
	bool result=streetNumberValidator->streetNumberHasAppropriateContent(symbols_);
	CPPUNIT_ASSERT_MESSAGE("Should fail because symbols are not valid content",result);

}

void	NumberValidatorTests::streetNumberHasAppropriateContent_MixContent_ReturnFalse(){
	string *streetNumer=new string("213ASD");
	*streetNumer+=*symbols_;
	bool result=streetNumberValidator->streetNumberHasAppropriateContent(streetNumer);
	delete streetNumer;
	CPPUNIT_ASSERT_MESSAGE("Should fail because mixing symbols,chars and numbers is not valid content",result);

}
